
<h2 align="center">销售订单(<%= @order.order_num %>)信息</h2>

<table width="700" align="center">
  <tr><td width="15%">应到金额(USD)</td><td width="15%"><%=number_to_usd @order.sumusd_sh %></td><td width="15%">到款方式</td><td width="25%"><%= @order.payment %></td><td width="10%">订单号</td><td width="20%"><%= @order.order_num %></td></tr>
  <tr><td width="15%">实到金额(USD)</td><td><%=number_to_usd @order.sumusd_re %></td><td width="15%">折合人民币</td><td><%=number_to_rmb @order.sum_rmb %></td><td width="10%">日期</td><td><%= @order.created_at.strftime '%Y-%m-%d' %></td></tr>
</table>
<table width="700" align="center">  
  <tr><td rowspan="6" width="10%">客户信息</td><td width="10%">客户名称</td><td width="30%"><%= @customer.customer %></td><td width="15%">国家</td><td><%= @customer.country %></td></tr>
  <tr><td width="10%">联系人</td><td><%= @customer.contact %></td><td width="15%">市场区域</td><td><%= @order.aim_area %></td></tr>
  <tr><td width="10%">E-mail</td><td><%= @customer.email %></td><td width="15%">电话</td><td><%= @customer.tel %></td></tr>
  <tr><td width="10%">语言要求</td><td><%= @order.req_lang %></td><td width="15%">使用手册要求</td><td><%= @order.req_manual %></td></tr>
  <tr><td width="10%">频段要求</td><td><%= @order.req_band %></td><td width="15%">充电器要求</td><td><%= @order.req_charge %></td></tr>
</table>
<table width="700" align="center">
  <tr>
    <th></th>
    <th>编号</th>
    <th>产品</th>
    <th>数量</th>
    <th>价格</th>
    <th>单价</th>
    <th>金额</th>
    <th>备货成本</th>
    <th>相关要求(如CE认证)</th>
    <% if not params[:print]%>
        <th colspan="2">操作</th>
    <% end %>
  </tr>
  
<td rowspan="<%= @lines.size + 3 %>" width="10%">备货清单</td>
<% for i in 1..@lines.size 
      line = @lines[i-1] %>
  <tr>    
    <td align="right"><%= i %></td>
    <td><%=h line.product %></td>
    <td><%=h line.qty %></td>
    <td align="right"><%=number_to_usd line.price %></td>
    <td align="right"><%=number_to_rmb line.unitcost %></td>
    <td align="right"><%=number_to_usd line.sum_sales %></td>
    <td align="right"><%=number_to_rmb line.sum_cost %></td>
    <td><%=h line.req %></td>
    <% if not params[:print]%>
    <td><%= link_to '编辑', :action => 'order_editline', :id => line %></td>
    <td><%= link_to '删除', line, :confirm => '确定删除该行信息么?', :method => :delete %></td>
    <% end %>
  </tr>  
<% end %>
<tr><td>运费</td><td colspan="4"></td><td  align="right"><%=number_to_usd @order.delv_price %></td><td align="right"><%=number_to_rmb @order.delv_cost %></td><td></td>
<% if not params[:print]%>
    <td colspan="2"></td>
<% end %>    
</tr>
<tr><td>总计</td><td colspan="4"></td><td  align="right"><%=number_to_usd @order.total_amount %></td><td align="right"><%= number_to_rmb @order.total_cost %></td><td></td>
<% if not params[:print]%>
<td colspan="2" align="center">
    <%= link_to '新增订单行', {:controller => "store", :action=> "order_newline", :id => @order.order_num} %>
</td>
<% end %>
</tr>
  
</table>
<table width="700" align="center">   
   <tr><td rowspan="4" width="10%">发运信息</td><td width="15%">计划发运方式</td><td><%= @order.delv_plan %></td></tr>
   <tr><td>实际发运方式</td><td><%= @order.delv_real %></td></tr>
   <tr><td>跟踪号</td><td><%= @order.track_num %></td></tr>
   <tr><td>收件人信息（地址、电话等）</td><td><%= @order.delv_addr %></td></tr>
</table>
<table width="700" align="center">
  <tr><td width="10%">订单状态</td><td width="30%"><%= @order.status %></td><td width="15%">毛利润(RMB)</td><td><%= number_to_rmb(@order.profit) if params[:print]%></td></tr>
</table>
<br />
<div align="center">
  <% if not params[:print]%>
    <%= link_to '编辑', :action => 'order_lines_edit', :id => @order.order_num %>
    <%= link_to '返回列表', :controller => 'orders', :action => 'index' %>
    <a href='/store/order_lines/<%= @order.order_num %>?print=true'>打印显示</a>
  <% else %>
    <a href='/store/order_lines/<%= @order.order_num %>'>返回</a>
  <% end %>
</div>
<br />
